package com.push.xu.pushutil;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.push.xu.xpush.constant.Constant;
import com.push.xu.xpush.core.ZPushContext;
import com.push.xu.xpush.util.SPUtils;

public class MainActivity extends AppCompatActivity {

    Button bt1,bt2,bt3;
    EditText et1,et2;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        bt1 =  findViewById(R.id.bt1);
        bt2 = findViewById(R.id.tag_bt);
        bt3 = findViewById(R.id.delete_tag_bt);
        et1 = findViewById(R.id.tag_et);
        et2 = findViewById(R.id.delete_tag_et);

        bt1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String token = SPUtils.getInstance(Constant.PUSH_MESSAGE_TABLE).getString("push_token");
                Toast.makeText(MainActivity.this,token,Toast.LENGTH_SHORT).show();

            }
        });
        bt2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String s = et1.getText().toString().trim();
                ZPushContext.getInstance().addTag(s);
            }
        });
        bt3.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                String s = et2.getText().toString().trim();
                ZPushContext.getInstance().deleteTag(s);
            }
        });
    }
}
